home *** CD-ROM | disk | FTP | other *** search
/ MacTech 1 to 12 / MacTech-vol-1-12.toast / Source / MacTech® Magazine / Volume 07 - 1991 / 07.03 Mar 91 / SAY() / Test Speech.Bas < prev   
Encoding:
BASIC Source File  |  1992-07-12  |  1002 b   |  39 lines  |  [TEXT/MSBA]

  1. ' This QuickBASIC program tests the SAY() pure-code resource routine.
  2. ' Copyright (C)1988 by William H. Ball for MacTutor™ magazine.
  3.  
  4. ' Usage: SAY(rate,pitch,string-expression)
  5.  
  6. ' Beware!  Will bomb with wrong number or type of arguments! Make sure
  7. ' MacinTalk is on the same volume, or SAY() will not talk.
  8.  
  9. DEFINT a-z
  10. LIBRARY "Speechd.lib"                        
  11.     ON ERROR GOTO 9
  12.     PRINT "Let's test the SAY() routine:"
  13.     GOSUB talk
  14. 9  LIBRARY CLOSE
  15. END
  16.  
  17. talk:
  18.     rate = 0            ' declare integer and string variables
  19.     pitch = 0
  20.     message$ = ""
  21.  
  22.     INPUT "Enter something to say: ";message$
  23.     INPUT "Enter a rate of speech between 0 and 425";rate
  24.     INPUT "Enter a pitch of speech between 0 and 500";pitch
  25.  
  26.     ' Just hit Return? Use a default value
  27.     IF rate = 0 THEN rate = 100
  28.     IF pitch = 0 THEN pitch = 100
  29.  
  30.     CALL SAY(rate,pitch,message$) 
  31.     
  32.     PRINT  "another?"
  33.     message$=INPUT$(1)
  34.     IF LEFT$(message$,1) = "y" THEN 
  35.         GOSUB talk
  36.     END IF
  37. RETURN
  38.  
  39.